import axios from '@/libs/axios1'
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' }
import { responesAssemble, requestAssemble } from'@/libs/utils'
import qs from 'qs'
let studentIntegral = `/self-study/studentIntegral`
let exam = `/self-study/exam`
let exp = `/self-study/exp`
let home = `/self-study/home`
let mycourse = `/self-study/mycourse`
let assessment = `/assessment/assessment`
let newclassrelation = `/self-study/expTrain` ///expTrain/exp/queryClass
// 分页获取考试列表
export const getUserExamByPage = (userId,params) => {
    return axios({
        url: `/self-study/exam/examination/selectByUser/page/${userId}`,
        method: 'get',
        headers: jsonHeaders,
        params:params
    })
}


export const queryClassByexp = (params) => {
    return axios({
        url: `/self-study/expTrain/exp/queryClass`,//GET /expTrain/exp/queryClass
        method: 'get',
        headers: jsonHeaders,
        params:params
    })
}

//查询竞赛列表
export const getCompositeScoreList = params => {
    params = requestAssemble(params)
    return axios({
        url: `/compete/competitive/page`,
        method: 'get',
        params: params,
        headers: jsonHeaders
    })
}

//查询竞赛列表-新
export const getCompositeScoreListNew = params => {
    params = requestAssemble(params)
    return axios({
        url: `/self-study/home/pageGsyh`,
        // url: `/compete/competitive/pageGsyh`,
        method: 'get',
        params: params,
        headers: jsonHeaders
    })
}

//查询用户考试任务
export const getUserExam = (userId,params) => {
    return axios({
        url: `/self-study/exam/examination/selectByUser/${userId}`,
        method: 'get',
        headers: jsonHeaders,
        params:params
    })
}

// 查询有多少课程
export const getCourseList = id => {
    return axios({
        url: `/self-study/mycourse/list?userid=${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}

// 查询有多少课件
export const getExpList = id => {
    return axios({
        url: `/self-study/mycourse/myExp/list?userid=${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 所有课程
export const getAllCourse = params => {
    return axios({
        url: `/self-study/mycourse/page?page=${params.page}&rows=${params.size}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
// 所有课件
export const getAllExp = params => {
    return axios({
        url: `/self-study/mycourse/myExp/page?page=${params.page}&rows=${params.size}`,
        method: 'get',
        headers: jsonHeaders,
    })
}

// 占用资源
export const getRourse = params => {
    return axios({
        url: `/self-study/mycourse/statistics?userId=${params}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
//获取竞争力情况(ctf和知识赛)
export const getCompetStatic= (params) => {
    params = requestAssemble(params)
    return new Promise(resolve => {
        axios({
            url: `/compete/competitive/des`,
            method: 'get',
            params:params,
            headers: jsonHeaders,
        }).then(res => {
            resolve(responesAssemble(res))
        })
    });
}

//获取竞争力情况(ctf和知识赛)-新
export const getCompetStaticNew= (params) => {
    params = requestAssemble(params)
    return new Promise(resolve => {
        axios({
            url: `/self-study/home/des`,// 新极核 竞争力换的接口
            //url: `/compete/competitive/desNew`,
            method: 'get',
            params:params,
            headers: jsonHeaders,
        }).then(res => {
            resolve(responesAssemble(res))
        })
    });
}

//获取考试竞争力情况
export const getExamStatic= () => {
  return axios({
    url: `/self-study/exam/examination/competitive`,
    method: 'get',
    headers: jsonHeaders,
  })
}
//获取我的考试情况
export const getMyExamGrade= (params) => {
  return axios({
    url: `/self-study/exam/examination/selectUserExam`,
    method: 'get',
    params: params,
    headers: jsonHeaders,
  })
}
//获取试验知识点统计
export const statisticsExp= () => {
  return axios({
    url: `/self-study/exp/statistics`,
    method: 'get',
    headers: jsonHeaders,
  })
}
//场景竞赛参与数量
export const statisticsDrillAndRace= (userId) => {
    return new Promise(resolve => {
        axios({
            url: `/compete/contest/statistic/${userId}`,
            method: 'get',
            headers: jsonHeaders,
        }).then(res => {
            resolve(responesAssemble(res))
        })
    });
}

// 获取竞赛成绩
export const getAllScore= (params) => {
    params = requestAssemble(params)
    return new Promise(resolve => {
        axios({
            url: `/compete/competitive/allScore`,
            method: 'get',
            params:params,
            headers: jsonHeaders,
        }).then(res => {
            resolve(responesAssemble(res))
        })
    });
}
//获取工程列表
export const getPrjList = () => {
    return axios({
        url: `/process/experimenter/scenes?pageIndex=1&pageSize=10000`,
        method: 'get',
        headers: jsonHeaders
    })
}
//查询报告归档分页
export const getArchivePage= (params) => {
    return axios({
        url: `/self-study/report/getArchivePage`,
        method: 'get',
        params:params,
        headers: jsonHeaders,
    })
}
//归档报告详细
export const getArchiveDeatil= (id) => {
    return axios({
        url: `/self-study/report/getArchive/${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
//创建归档
export const addArchive= (data) => {
    return axios({
        url: `/self-study/report/addArchive`,
        method: 'post',
        data:data,
        headers: jsonHeaders,
    })
}
//删除归档
export const delArchive= (id) => {
    return axios({
        url: `/self-study/report/deleteArchive/${id}`,
        method: 'delete',
        headers: jsonHeaders,
    })
}

// 任务列表查询
export const getTaskList = params => {
    return axios({
        url: `/drill-task/studyTask?type=${params.type}&startTime=${params.sTime}&endTime=${params.eTime}`,
        method: 'get',
        headers: jsonHeaders,
    })
}
//操作员任务列表
export const getTaskExperList = (params) => {
    return axios({
        url: `${home}/queryTaskExList`,
        method: 'get',
        params,
        headers: jsonHeaders
    })
}

// 查询用户积分排名情况
export const getIntegralDetail = params => {
    return axios({
        url: `/compete/competitive/page`,
        method: 'get',
        headers: jsonHeaders,
        params
    })
}

export const getIntegralDetail1 = userId => { // 新极核积分勋章
    return axios({
        url: `/self-study/studentIntegral/queryUserInfo/${userId}`,
        method: 'get',
        headers: jsonHeaders,
    })
}

export const getClassCount = params=> {
    return axios({
        // GET /classrelation/classManage/getCountByUserId
        url: `/self-study/classrelation/classManage/getCountByUserId`,
        method: 'get',
        params: params,
        headers: jsonHeaders
    })
}

//获取上课总数据
export const queryExperimenterCourse1 = params => {

    let newparm = {
        pageIndex:params.pageIndex,
        pageSize:params.pageSize,
        egStatus:params.state,
        egName:params.courseName,
        teacherName:params.teacherName
    }


    return axios({
        url: `${newclassrelation}/exp/queryClass`,
        method: 'get',
        params: newparm,
        headers: jsonHeaders

    })
}